public class Test {
    public static void main(String[] args) {
        //1. 判定⼀个数字是否是素数  16    1*16  2*8  4*4
        int num =7;
        int i =1;
        for ( i = 2; i <=Math.sqrt(num); i++) {
            if (num % i == 0){
                System.out.println(num+" 不是素数");
                break;
            }
            }
        if(i >Math.sqrt(num)){
            System.out.println(num+" 是素数");
        }
    }
    public static void main8(String[] args) {
        //计算 1! + 2! + 3! + 4! +5！
        int x = 1;
        int a = 1;
        int sum = 0;
        for ( x = 1; x <=5 ; x++) {
            int ret = 1;
            for (a= 1; a<=x;a++){
                ret *=a;
            }
            sum+=ret;
        }
        System.out.println(sum);
    }
    public static void main7(String[] args) {
        //找到 100 - 200 中所有 3 的倍数
        int a =100;
        while (a<=200){
            if (a%3!=0){
                a++;
                continue;
            }
                System.out.println(a);
                a++;
        }
    }
    public static void main6(String[] args) {
        //找到 100 - 200 中第⼀个 3 的倍数
        int a = 100;
        while(a<=200){
            if (a%3==0){
                System.out.println(a);
                break;
            }
            a++;
        }


    }
    public static void main5(String[] args) {
        //1! + 2! + 3! + 4! + 5!
        int a =1;
        int ret = 1;
        int x = 1;
        int sum =0;
        while (x <= 5) {
            while (a<=x){
                ret*=a;
                a++;
        }
            sum+=ret;
            x++;
        }
        System.out.println(sum);
    }
    public static void main4(String[] args) {
        //计算 5 的阶乘
        int a =1;
        int ret = 1;
        while (a<=5){
            ret*=a;
            a++;
        }
        System.out.println(ret);
    }
    public static void main3(String[] args) {
        //计算 1 - 100 的和
        int a = 1;
        int sum = 0;
        while (a<=100){
            sum +=a;
            a++;
        }
        System.out.println(sum);
    }
    public static void main2(String[] args) {
        //打印 1 - 10 的数字
        int a = 1;
        while (a<=10){
            System.out.println(a);
            a++;
        }
    }
    public static void main1(String[] args) {
        int day = 0;
        switch(day){
            case 1:
                System.out.println("星期一");
            case 2:
                System.out.println("星期二");
            case 3:
                System.out.println("星期三");
            case 4:
                System.out.println("星期四");
            case 5:
                System.out.println("星期五");
            case 6:
                System.out.println("星期六");
            case 7:
                System.out.println("星期天");
            default:
                System.out.println("出错了");

        }
    }
}
